/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import com.taobao.snowsnow.hibernate.dao.MaterialCollectDao;
import com.taobao.snowsnow.hibernate.pojo.MaterialCollect;
import com.taobao.snowsnow.hibernate.service.MaterialCollectService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class MaterialCollectServiceImpl extends BaseServiceImpl implements MaterialCollectService {
	private MaterialCollectDao mdao;
	
	public List<MaterialCollect> findAll() throws Exception {
		try {
			return mdao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
			throw e;
		}
	}

	public MaterialCollect findById(int id) throws Exception {
		try {
			return mdao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
			throw e;
		}
	}
	
	public List<MaterialCollect> findByName(String name) throws Exception {
		try {
			return mdao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
			throw e;
		}
	}

	public long getTotal() throws Exception  {
		try {
			return mdao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
			throw e;
		}
	}

	public List<MaterialCollect> paging(int page, int limit) throws Exception  {
		try {
			return mdao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
			throw e;
		}
	}

	public void setMdao(MaterialCollectDao edao) {
		this.mdao = edao;
	}

	public MaterialCollectDao getMdao() {
		return mdao;
	}

	@Override
	public MaterialCollect getFirstObject() throws Exception {
		try {
			return mdao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("MaterialCollect getFirstObject()");
			throw e;
		}
	}

	@Override
	public MaterialCollect getLastObject() throws Exception {
		try {
			return mdao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("MaterialCollect getLastObject()");
			throw e;
		}
	}

	@Override
	public MaterialCollect findByNamePrecise(String name) throws Exception {
		try {
			return mdao.findByNamePrecise(name);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("MaterialCollect getLastObject()");
			throw e;
		}
	}
}
